<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title>登陆</title>
		<meta name="description" content="description">
		<meta name="author" content="Evgeniya">
		<meta name="keyword" content="keywords">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link href="./plugins/bootstrap/bootstrap.css" rel="stylesheet">
		<link href="http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
		<link href="./css/style.css" rel="stylesheet">
		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!--[if lt IE 9]>
				<script src="http://getbootstrap.com/docs-assets/js/html5shiv.js"></script>
				<script src="http://getbootstrap.com/docs-assets/js/respond.min.js"></script>
		<![endif]-->
	</head>
<body>
<div class="container-fluid">
	<div id="page-login" class="row">
		<div class="col-xs-12 col-md-4 col-md-offset-4 col-sm-6 col-sm-offset-3">
			<div class="box">
				<div class="box-content">
					<div class="text-center">
						<h3 class="page-header">yunPass云物管</h3>
					</div>
					<div class="form-group">
						<label class="control-label">用户名</label>
						<input type="text" class="form-control" id="username" />
					</div>
					<div class="form-group">
						<label class="control-label">密码</label>
						<input type="password" class="form-control" id="password" />
					</div>
					<div class="text-center">
						<a href="javascript:void(0)" id="loginSubmit" class="btn btn-primary">登陆</a>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script src="./plugins/jquery/jquery-2.1.0.min.js"></script>
<script src="./js/config.js"></script>
<script type="text/javascript">
$("#loginSubmit").click(function(){
    var username=$("#username").val();
    var password=$("#password").val();
    if(username=="")
        alert("请输入用户名");
    else if(password=="")
        alert("请输入密码");
    else {
        $.ajax({
            type: "post",
            async: true,
            url:urlConfig.login,
            data: {
                username:username,
                password:password
            },
            dataType: "json", //返回数据形式为json
            success: function (result) {
                if (result.status) {
                    window.location.href=urlConfig.home;
                }
                else {
                    alert(result.errorMsg.description);
                }
            },
            error: function () {
                alert("服务器连接失败,请重试!");
            }
        });
    }
});

</script>
</body>
</html>
